home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 1999 #5 / 1999 CD 5 (black).iso / Delphi3 / install / data.z / RICHEDIT.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-08-04  |  28.9 KB  |  824 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Runtime Library                          }
  5. {       Windows 32bit API Interface Unit                }
  6. {                                                       }
  7. {       Copyright (c) 1996,97 Borland International     }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit RichEdit;
  12.  
  13. {$WEAKPACKAGEUNIT}
  14.  
  15. interface
  16.  
  17. uses Messages, Windows;
  18.  
  19. const
  20.   cchTextLimitDefault     = 32767; 
  21.  
  22.  
  23.   RICHEDIT_CLASSA         = 'RichEdit20A';     { Richedit2.0 Window Class. }
  24.   RICHEDIT_CLASSW         = 'RichEdit20W';     { Richedit2.0 Window Class. }
  25.   RICHEDIT_CLASS = RICHEDIT_CLASSA;
  26.   RICHEDIT_CLASS10A       = 'RICHEDIT';        { Richedit 1.0 }
  27.  
  28. { RichEdit messages }
  29.  
  30.   WM_CONTEXTMENU                      = $007B; 
  31.   WM_PRINTCLIENT                      = $0318; 
  32.  
  33.   EM_GETLIMITTEXT                     = WM_USER + 37; 
  34. //  EM_POSFROMCHAR                      = WM_USER + 38;
  35. //  EM_CHARFROMPOS                      = WM_USER + 39; 
  36.   EM_SCROLLCARET                      = WM_USER + 49; 
  37.   EM_CANPASTE                         = WM_USER + 50; 
  38.   EM_DISPLAYBAND                      = WM_USER + 51; 
  39.   EM_EXGETSEL                         = WM_USER + 52; 
  40.   EM_EXLIMITTEXT                      = WM_USER + 53; 
  41.   EM_EXLINEFROMCHAR                   = WM_USER + 54; 
  42.   EM_EXSETSEL                         = WM_USER + 55; 
  43.   EM_FINDTEXT                         = WM_USER + 56; 
  44.   EM_FORMATRANGE                      = WM_USER + 57; 
  45.   EM_GETCHARFORMAT                    = WM_USER + 58; 
  46.   EM_GETEVENTMASK                     = WM_USER + 59; 
  47.   EM_GETOLEINTERFACE                  = WM_USER + 60; 
  48.   EM_GETPARAFORMAT                    = WM_USER + 61; 
  49.   EM_GETSELTEXT                       = WM_USER + 62; 
  50.   EM_HIDESELECTION                    = WM_USER + 63; 
  51.   EM_PASTESPECIAL                     = WM_USER + 64; 
  52.   EM_REQUESTRESIZE                    = WM_USER + 65; 
  53.   EM_SELECTIONTYPE                    = WM_USER + 66; 
  54.   EM_SETBKGNDCOLOR                    = WM_USER + 67; 
  55.   EM_SETCHARFORMAT                    = WM_USER + 68; 
  56.   EM_SETEVENTMASK                     = WM_USER + 69; 
  57.   EM_SETOLECALLBACK                   = WM_USER + 70; 
  58.   EM_SETPARAFORMAT                    = WM_USER + 71; 
  59.   EM_SETTARGETDEVICE                  = WM_USER + 72; 
  60.   EM_STREAMIN                         = WM_USER + 73; 
  61.   EM_STREAMOUT                        = WM_USER + 74; 
  62.   EM_GETTEXTRANGE                     = WM_USER + 75; 
  63.   EM_FINDWORDBREAK                    = WM_USER + 76; 
  64.   EM_SETOPTIONS                       = WM_USER + 77; 
  65.   EM_GETOPTIONS                       = WM_USER + 78; 
  66.   EM_FINDTEXTEX                       = WM_USER + 79; 
  67.   EM_GETWORDBREAKPROCEX               = WM_USER + 80; 
  68.   EM_SETWORDBREAKPROCEX               = WM_USER + 81; 
  69.  
  70. { Richedit v2.0 messages }
  71.  
  72.   EM_SETUNDOLIMIT                     = WM_USER + 82; 
  73.   EM_REDO                             = WM_USER + 84; 
  74.   EM_CANREDO                          = WM_USER + 85; 
  75.   EM_GETUNDONAME                      = WM_USER + 86; 
  76.   EM_GETREDONAME                      = WM_USER + 87; 
  77.   EM_STOPGROUPTYPING                  = WM_USER + 88; 
  78.   EM_SETTEXTMODE                      = WM_USER + 89; 
  79.   EM_GETTEXTMODE                      = WM_USER + 90; 
  80.  
  81. { for use with EM_GET/SETTEXTMODE }
  82.  
  83.   TM_PLAINTEXT                       = 1; 
  84.   TM_RICHTEXT                        = 2;     { default behavior }
  85.   TM_SINGLELEVELUNDO                 = 4; 
  86.   TM_MULTILEVELUNDO                  = 8;     { default behavior }
  87.   TM_SINGLECODEPAGE                  = 16; 
  88.   TM_MULTICODEPAGE                   = 32;    { default behavior }
  89.  
  90.   EM_AUTOURLDETECT                    = WM_USER + 91; 
  91.   EM_GETAUTOURLDETECT                 = WM_USER + 92; 
  92.   EM_SETPALETTE                       = WM_USER + 93; 
  93.   EM_GETTEXTEX                        = WM_USER + 94; 
  94.   EM_GETTEXTLENGTHEX                  = WM_USER + 95; 
  95.  
  96. { Far East specific messages }
  97.  
  98.   EM_SETPUNCTUATION                   = WM_USER + 100; 
  99.   EM_GETPUNCTUATION                   = WM_USER + 101; 
  100.   EM_SETWORDWRAPMODE                  = WM_USER + 102; 
  101.   EM_GETWORDWRAPMODE                  = WM_USER + 103; 
  102.   EM_SETIMECOLOR                      = WM_USER + 104; 
  103.   EM_GETIMECOLOR                      = WM_USER + 105; 
  104.   EM_SETIMEOPTIONS                    = WM_USER + 106; 
  105.   EM_GETIMEOPTIONS                    = WM_USER + 107; 
  106.   EM_CONVPOSITION                     = WM_USER + 108; 
  107.  
  108.   EM_SETLANGOPTIONS                   = WM_USER + 120; 
  109.   EM_GETLANGOPTIONS                   = WM_USER + 121; 
  110.   EM_GETIMECOMPMODE                   = WM_USER + 122; 
  111.  
  112. { Options for EM_SETLANGOPTIONS and EM_GETLANGOPTIONS }
  113.  
  114.   IMF_AUTOKEYBOARD            = $0001; 
  115.   IMF_AUTOFONT                = $0002; 
  116.   IMF_IMECANCELCOMPLETE       = $0004;  { high completes the comp string when aborting, low cancels. }
  117.   IMF_IMEALWAYSSENDNOTIFY     = $0008; 
  118.  
  119. { Values for EM_GETIMECOMPMODE }
  120.  
  121.   ICM_NOTOPEN                         = $0000; 
  122.   ICM_LEVEL3                          = $0001; 
  123.   ICM_LEVEL2                          = $0002; 
  124.   ICM_LEVEL2_5                        = $0003; 
  125.   ICM_LEVEL2_SUI                      = $0004; 
  126.  
  127. { New notifications }
  128.  
  129.   EN_MSGFILTER                        = $0700; 
  130.   EN_REQUESTRESIZE                    = $0701; 
  131.   EN_SELCHANGE                        = $0702; 
  132.   EN_DROPFILES                        = $0703; 
  133.   EN_PROTECTED                        = $0704; 
  134.   EN_CORRECTTEXT                      = $0705;                  { PenWin specific }
  135.   EN_STOPNOUNDO                       = $0706; 
  136.   EN_IMECHANGE                        = $0707;                  { Far East specific }
  137.   EN_SAVECLIPBOARD                    = $0708; 
  138.   EN_OLEOPFAILED                      = $0709; 
  139.   EN_OBJECTPOSITIONS                  = $070a; 
  140.   EN_LINK                             = $070b; 
  141.   EN_DRAGDROPDONE                     = $070c; 
  142.  
  143. { Event notification masks }
  144.  
  145.   ENM_NONE                            = $00000000; 
  146.   ENM_CHANGE                          = $00000001; 
  147.   ENM_UPDATE                          = $00000002; 
  148.   ENM_SCROLL                          = $00000004; 
  149.   ENM_KEYEVENTS                       = $00010000; 
  150.   ENM_MOUSEEVENTS                     = $00020000; 
  151.   ENM_REQUESTRESIZE                   = $00040000; 
  152.   ENM_SELCHANGE                       = $00080000; 
  153.   ENM_DROPFILES                       = $00100000; 
  154.   ENM_PROTECTED                       = $00200000; 
  155.   ENM_CORRECTTEXT                     = $00400000;              { PenWin specific }
  156.   ENM_SCROLLEVENTS                    = $00000008; 
  157.   ENM_DRAGDROPDONE                    = $00000010; 
  158.  
  159. { Far East specific notification mask }
  160.  
  161.   ENM_IMECHANGE                       = $00800000;              { unused by RE2.0 }
  162.   ENM_LANGCHANGE                      = $01000000; 
  163.   ENM_OBJECTPOSITIONS                 = $02000000; 
  164.   ENM_LINK                            = $04000000; 
  165.  
  166. { New edit control styles }
  167.  
  168.   ES_SAVESEL                          = $00008000; 
  169.   ES_SUNKEN                           = $00004000; 
  170.   ES_DISABLENOSCROLL                  = $00002000;
  171. { same as WS_MAXIMIZE, but that doesn't make sense so we re-use the value }
  172.   ES_SELECTIONBAR                     = $01000000; 
  173. { same as ES_UPPERCASE, but re-used to completely disable OLE drag'n'drop }
  174.   ES_NOOLEDRAGDROP                    = $00000008; 
  175.  
  176. { New edit control extended style }
  177.  
  178.   ES_EX_NOCALLOLEINIT                 = $01000000; 
  179.  
  180. { These flags are used in FE Windows }
  181.  
  182.   ES_VERTICAL                         = $00400000; 
  183.   ES_NOIME                            = $00080000; 
  184.   ES_SELFIME                          = $00040000; 
  185.  
  186. { Edit control options }
  187.  
  188.   ECO_AUTOWORDSELECTION       = $00000001; 
  189.   ECO_AUTOVSCROLL             = $00000040; 
  190.   ECO_AUTOHSCROLL             = $00000080; 
  191.   ECO_NOHIDESEL               = $00000100; 
  192.   ECO_READONLY                = $00000800; 
  193.   ECO_WANTRETURN              = $00001000; 
  194.   ECO_SAVESEL                 = $00008000; 
  195.   ECO_SELECTIONBAR            = $01000000; 
  196.   ECO_VERTICAL                = $00400000;              { FE specific }
  197.  
  198. { ECO operations }
  199.  
  200.   ECOOP_SET                                   = $0001; 
  201.   ECOOP_OR                                    = $0002; 
  202.   ECOOP_AND                                   = $0003; 
  203.   ECOOP_XOR                                   = $0004; 
  204.  
  205. { new word break function actions }
  206.  
  207.   WB_CLASSIFY                 = 3; 
  208.   WB_MOVEWORDLEFT             = 4; 
  209.   WB_MOVEWORDRIGHT            = 5; 
  210.   WB_LEFTBREAK                = 6; 
  211.   WB_RIGHTBREAK               = 7; 
  212.  
  213. { Far East specific flags }
  214.  
  215.   WB_MOVEWORDPREV             = 4; 
  216.   WB_MOVEWORDNEXT             = 5; 
  217.   WB_PREVBREAK                = 6; 
  218.   WB_NEXTBREAK                = 7; 
  219.  
  220.   PC_FOLLOWING                = 1; 
  221.   PC_LEADING                  = 2; 
  222.   PC_OVERFLOW                 = 3; 
  223.   PC_DELIMITER                = 4; 
  224.   WBF_WORDWRAP                = $010; 
  225.   WBF_WORDBREAK               = $020; 
  226.   WBF_OVERFLOW                = $040; 
  227.   WBF_LEVEL1                  = $080; 
  228.   WBF_LEVEL2                  = $100; 
  229.   WBF_CUSTOM                  = $200; 
  230.  
  231. { Far East specific flags }
  232.  
  233.   IMF_FORCENONE               = $0001; 
  234.   IMF_FORCEENABLE             = $0002; 
  235.   IMF_FORCEDISABLE            = $0004; 
  236.   IMF_CLOSESTATUSWINDOW       = $0008; 
  237.   IMF_VERTICAL                = $0020; 
  238.   IMF_FORCEACTIVE             = $0040; 
  239.   IMF_FORCEINACTIVE           = $0080; 
  240.   IMF_FORCEREMEMBER           = $0100; 
  241.   IMF_MULTIPLEEDIT            = $0400; 
  242.  
  243. { Word break flags (used with WB_CLASSIFY) }
  244.  
  245.   WBF_CLASS                   = $0F; 
  246.   WBF_ISWHITE                 = $10; 
  247.   WBF_BREAKLINE               = $20; 
  248.   WBF_BREAKAFTER              = $40; 
  249.  
  250. { all character format measurements are in twips }
  251.  
  252. type
  253.   TCharFormatA = record
  254.     cbSize: UINT;
  255.     dwMask: Longint;
  256.     dwEffects: Longint;
  257.     yHeight: Longint;
  258.     yOffset: Longint;
  259.     crTextColor: TColorRef;
  260.     bCharSet: Byte;
  261.     bPitchAndFamily: Byte;
  262.     szFaceName: array[0..LF_FACESIZE - 1] of AnsiChar;
  263.   end;
  264.   TCharFormatW = record
  265.     cbSize: UINT;
  266.     dwMask: Longint;
  267.     dwEffects: Longint;
  268.     yHeight: Longint;
  269.     yOffset: Longint;
  270.     crTextColor: TColorRef;
  271.     bCharSet: Byte;
  272.     bPitchAndFamily: Byte;
  273.     szFaceName: array[0..LF_FACESIZE - 1] of WideChar;
  274.   end;
  275.   TCharFormat = TCharFormatA;
  276.  
  277. { CHARFORMAT masks }
  278.  
  279. const
  280.   CFM_BOLD            = $00000001; 
  281.   CFM_ITALIC          = $00000002; 
  282.   CFM_UNDERLINE       = $00000004; 
  283.   CFM_STRIKEOUT       = $00000008; 
  284.   CFM_PROTECTED       = $00000010; 
  285.   CFM_LINK            = $00000020;              { Exchange hyperlink extension }
  286.   CFM_SIZE            = $80000000; 
  287.   CFM_COLOR           = $40000000; 
  288.   CFM_FACE            = $20000000; 
  289.   CFM_OFFSET          = $10000000; 
  290.   CFM_CHARSET         = $08000000; 
  291.  
  292. { CHARFORMAT effects }
  293.  
  294.   CFE_BOLD            = $0001; 
  295.   CFE_ITALIC          = $0002; 
  296.   CFE_UNDERLINE       = $0004; 
  297.   CFE_STRIKEOUT       = $0008; 
  298.   CFE_PROTECTED       = $0010; 
  299.   CFE_LINK            = $0020; 
  300.   CFE_AUTOCOLOR       = $40000000;  { NOTE: this corresponds to CFM_COLOR, }
  301.                                     { which controls it }
  302.   yHeightCharPtsMost  = 1638; 
  303.  
  304. { EM_SETCHARFORMAT wParam masks }
  305.  
  306.   SCF_SELECTION       = $0001; 
  307.   SCF_WORD            = $0002; 
  308.   SCF_DEFAULT         = $0000;          { set the default charformat or paraformat }
  309.   SCF_ALL             = $0004;          { not valid with SCF_SELECTION or SCF_WORD }
  310.   SCF_USEUIRULES      = $0008;          { modifier for SCF_SELECTION; says that }
  311.                                         { the format came from a toolbar, etc. and }
  312.                                         { therefore UI formatting rules should be }
  313.                                         { used instead of strictly formatting the }
  314.                                         { selection. }
  315.  
  316. type
  317.   TCharRange = record
  318.     cpMin: Longint;
  319.     cpMax: LongInt;
  320.   end;
  321.  
  322.   TTextRangeA = record
  323.     chrg: TCharRange;
  324.     lpstrText: AnsiChar;
  325.   end;
  326.   TTextRangeW = record
  327.     chrg: TCharRange;
  328.     lpstrText: WideChar;
  329.   end;
  330.   TTextRange = TTextRangeA;
  331.  
  332. type
  333.   TEditStreamCallBack = function (dwCookie: Longint; pbBuff: PByte; 
  334.     cb: Longint; var pcb: Longint): Longint;
  335.     
  336.   TEditStream = record
  337.     dwCookie: Longint;
  338.     dwError: Longint;
  339.     pfnCallback: TEditStreamCallBack;
  340.   end;
  341.  
  342. { stream formats }
  343.  
  344. const
  345.   SF_TEXT             = $0001; 
  346.   SF_RTF              = $0002; 
  347.   SF_RTFNOOBJS        = $0003;          { outbound only }
  348.   SF_TEXTIZED         = $0004;          { outbound only }
  349.   SF_UNICODE          = $0010;          { Unicode file of some kind }
  350.  
  351. { Flag telling stream operations to operate on the selection only }
  352. { EM_STREAMIN will replace the current selection }
  353. { EM_STREAMOUT will stream out the current selection }
  354.  
  355.   SFF_SELECTION       = $8000; 
  356.  
  357. { Flag telling stream operations to operate on the common RTF keyword only }
  358. { EM_STREAMIN will accept the only common RTF keyword }
  359. { EM_STREAMOUT will stream out the only common RTF keyword }
  360.  
  361.   SFF_PLAINRTF        = $4000; 
  362.  
  363. { EM_FINDTEXT flags (removed in 3.0 SDK - leave in!) }
  364.  
  365.   FT_MATCHCASE = 4;
  366.   FT_WHOLEWORD = 2;
  367.  
  368. type
  369.   TFindTextA = record
  370.     chrg: TCharRange;
  371.     lpstrText: PAnsiChar;
  372.   end;
  373. {#END}  
  374.  
  375. {#BEGIN}
  376.   TFindTextExA = record
  377.     chrg: TCharRange;
  378.     lpstrText: PAnsiChar;
  379.     chrgText: TCharRange;
  380.   end;
  381.   TFindTextW = record
  382.     chrg: TCharRange;
  383.     lpstrText: PWideChar;
  384.   end;
  385. {#END}  
  386.  
  387. {#BEGIN}
  388.   TFindTextExW = record
  389.     chrg: TCharRange;
  390.     lpstrText: PWideChar;
  391.     chrgText: TCharRange;
  392.   end;
  393.   TFindText = TFindTextA;
  394.  
  395.   TFormatRange = record
  396.     hdc: HDC;
  397.     hdcTarget: HDC;
  398.     rc: TRect;
  399.     rcPage: TRect;
  400.     chrg: TCharRange;
  401.   end;
  402.  
  403. { all paragraph measurements are in twips }
  404.  
  405. const
  406.   MAX_TAB_STOPS     = 32; 
  407.   lDefaultTab     = 720; 
  408.  
  409. type
  410.   TParaFormat = record
  411.     cbSize: UINT;
  412.     dwMask: DWORD;
  413.     wNumbering: Word;
  414.     wReserved: Word;
  415.     dxStartIndent: Longint;
  416.     dxRightIndent: Longint;
  417.     dxOffset: Longint;
  418.     wAlignment: Word;
  419.     cTabCount: Smallint;
  420.     rgxTabs: array [0..MAX_TAB_STOPS - 1] of Longint;
  421.   end;
  422.  
  423. { PARAFORMAT mask values }
  424.  
  425. const
  426.   PFM_STARTINDENT                     = $00000001; 
  427.   PFM_RIGHTINDENT                     = $00000002; 
  428.   PFM_OFFSET                          = $00000004; 
  429.   PFM_ALIGNMENT                       = $00000008; 
  430.   PFM_TABSTOPS                        = $00000010; 
  431.   PFM_NUMBERING                       = $00000020; 
  432.   PFM_OFFSETINDENT                    = $80000000; 
  433.  
  434. { PARAFORMAT numbering options }
  435.  
  436.   PFN_BULLET                  = $0001; 
  437.  
  438. { PARAFORMAT alignment options }
  439.  
  440.   PFA_LEFT            = $0001; 
  441.   PFA_RIGHT           = $0002; 
  442.   PFA_CENTER          = $0003; 
  443.  
  444. type  
  445.   TCharFormat2A = record
  446.     cbSize: UINT;
  447.     dwMask: DWORD;
  448.     dwEffects: DWORD;
  449.     yHeight: Longint;
  450.     yOffset: Longint;
  451.     crTextColor: TColorRef;
  452.     bCharSet: Byte;
  453.     bPitchAndFamily: Byte;
  454.     szFaceName: array[0..LF_FACESIZE - 1] of AnsiChar;
  455.     wWeight: Word;                   { Font weight (LOGFONT value)         }
  456.     sSpacing: Smallint;              { Amount to space between letters     }
  457.     crBackColor: TColorRef;          { Background color                     }
  458.     lid: LCID;                       { Locale ID                         }
  459.     dwReserved: DWORD;               { Reserved. Must be 0                 }
  460.     sStyle: Smallint;                { Style handle                         }
  461.     wKerning: Word;                  { Twip size above which to kern char pair }
  462.     bUnderlineType: Byte;            { Underline type                     }
  463.     bAnimation: Byte;                { Animated text like marching ants     }
  464.     bRevAuthor: Byte;                { Revision author index             }
  465.     bReserved1: Byte;
  466.   end;
  467.   TCharFormat2W = record
  468.     cbSize: UINT;
  469.     dwMask: DWORD;
  470.     dwEffects: DWORD;
  471.     yHeight: Longint;
  472.     yOffset: Longint;
  473.     crTextColor: TColorRef;
  474.     bCharSet: Byte;
  475.     bPitchAndFamily: Byte;
  476.     szFaceName: array[0..LF_FACESIZE - 1] of WideChar;
  477.     wWeight: Word;                   { Font weight (LOGFONT value)         }
  478.     sSpacing: Smallint;              { Amount to space between letters     }
  479.     crBackColor: TColorRef;          { Background color                     }
  480.     lid: LCID;                       { Locale ID                         }
  481.     dwReserved: DWORD;               { Reserved. Must be 0                 }
  482.     sStyle: Smallint;                { Style handle                         }
  483.     wKerning: Word;                  { Twip size above which to kern char pair }
  484.     bUnderlineType: Byte;            { Underline type                     }
  485.     bAnimation: Byte;                { Animated text like marching ants     }
  486.     bRevAuthor: Byte;                { Revision author index             }
  487.     bReserved1: Byte;
  488.   end;
  489.   TCharFormat2 = TCharFormat2A;
  490.  
  491. { CHARFORMAT and PARAFORMAT "ALL" masks
  492.   CFM_COLOR mirrors CFE_AUTOCOLOR, a little hack to easily deal with autocolor }
  493. const
  494.   CFM_EFFECTS = CFM_BOLD or CFM_ITALIC or CFM_UNDERLINE or CFM_COLOR or 
  495.     CFM_STRIKEOUT or CFE_PROTECTED or CFM_LINK; 
  496.   CFM_ALL = CFM_EFFECTS or CFM_SIZE or CFM_FACE or CFM_OFFSET or CFM_CHARSET; 
  497.   PFM_ALL = PFM_STARTINDENT or PFM_RIGHTINDENT or PFM_OFFSET or  
  498.     PFM_ALIGNMENT or PFM_TABSTOPS or PFM_NUMBERING or PFM_OFFSETINDENT; 
  499.  
  500. { New masks and effects -- a parenthesized asterisk indicates that
  501.    the data is stored by RichEdit2.0, but not displayed }
  502.  
  503.   CFM_SMALLCAPS               = $0040;                  { (*)     }
  504.   CFM_ALLCAPS                 = $0080;                  { (*)     }
  505.   CFM_HIDDEN                  = $0100;                  { (*)     }
  506.   CFM_OUTLINE                 = $0200;                  { (*)     }
  507.   CFM_SHADOW                  = $0400;                  { (*)     }
  508.   CFM_EMBOSS                  = $0800;                  { (*)     }
  509.   CFM_IMPRINT                 = $1000;                  { (*)     }
  510.   CFM_DISABLED                = $2000; 
  511.   CFM_REVISED                 = $4000; 
  512.  
  513.   CFM_BACKCOLOR               = $04000000; 
  514.   CFM_LCID                    = $02000000; 
  515.   CFM_UNDERLINETYPE           = $00800000;              { (*)     }
  516.   CFM_WEIGHT                  = $00400000; 
  517.   CFM_SPACING                 = $00200000;              { (*)     }
  518.   CFM_KERNING                 = $00100000;              { (*)     }
  519.   CFM_STYLE                   = $00080000;              { (*)     }
  520.   CFM_ANIMATION               = $00040000;              { (*)     }
  521.   CFM_REVAUTHOR               = $00008000; 
  522.  
  523.   CFE_SUBSCRIPT               = $00010000;              { Superscript and subscript are }
  524.   CFE_SUPERSCRIPT             = $00020000;              {  mutually exclusive             }
  525.  
  526.   CFM_SUBSCRIPT               = CFE_SUBSCRIPT or CFE_SUPERSCRIPT; 
  527.   CFM_SUPERSCRIPT             = CFM_SUBSCRIPT; 
  528.  
  529.   CFM_EFFECTS2 = CFM_EFFECTS or CFM_DISABLED or CFM_SMALLCAPS or CFM_ALLCAPS or 
  530.     CFM_HIDDEN  or CFM_OUTLINE or CFM_SHADOW or CFM_EMBOSS or 
  531.     CFM_IMPRINT or CFM_DISABLED or CFM_REVISED or 
  532.     CFM_SUBSCRIPT or CFM_SUPERSCRIPT or CFM_BACKCOLOR; 
  533.  
  534.   CFM_ALL2 = CFM_ALL or CFM_EFFECTS2 or CFM_BACKCOLOR or CFM_LCID or 
  535.     CFM_UNDERLINETYPE or CFM_WEIGHT or CFM_REVAUTHOR or 
  536.     CFM_SPACING or CFM_KERNING or CFM_STYLE or CFM_ANIMATION; 
  537.  
  538.   CFE_SMALLCAPS               = CFM_SMALLCAPS; 
  539.   CFE_ALLCAPS                 = CFM_ALLCAPS; 
  540.   CFE_HIDDEN                  = CFM_HIDDEN; 
  541.   CFE_OUTLINE                 = CFM_OUTLINE; 
  542.   CFE_SHADOW                  = CFM_SHADOW; 
  543.   CFE_EMBOSS                  = CFM_EMBOSS; 
  544.   CFE_IMPRINT                 = CFM_IMPRINT; 
  545.   CFE_DISABLED                = CFM_DISABLED; 
  546.   CFE_REVISED                 = CFM_REVISED; 
  547.  
  548. { NOTE: CFE_AUTOCOLOR and CFE_AUTOBACKCOLOR correspond to CFM_COLOR and
  549.    CFM_BACKCOLOR, respectively, which control them }
  550.    
  551.   CFE_AUTOBACKCOLOR           = CFM_BACKCOLOR; 
  552.  
  553. { Underline types }
  554.  
  555.   CFU_CF1UNDERLINE            = $FF;    { map charformat's bit underline to CF2. }
  556.   CFU_INVERT                  = $FE;    { For IME composition fake a selection. }
  557.   CFU_UNDERLINEDOTTED         = $4;             { (*) displayed as ordinary underline     }
  558.   CFU_UNDERLINEDOUBLE         = $3;             { (*) displayed as ordinary underline     }
  559.   CFU_UNDERLINEWORD           = $2;             { (*) displayed as ordinary underline     }
  560.   CFU_UNDERLINE               = $1; 
  561.   CFU_UNDERLINENONE           = 0; 
  562.  
  563. type  
  564.   TParaFormat2 = record
  565.     cbSize: UINT;
  566.     dwMask: DWORD;
  567.     wNumbering: Word;
  568.     wReserved: Word;
  569.     dxStartIndent: Longint;
  570.     dxRightIndent: Longint;
  571.     dxOffset: Longint;
  572.     wAlignment: Word;
  573.     cTabCount: Smallint;
  574.     rgxTabs: array [0..MAX_TAB_STOPS - 1] of Longint;
  575.     dySpaceBefore: Longint;     { Vertical spacing before para             }
  576.     dySpaceAfter: Longint;      { Vertical spacing after para             }
  577.     dyLineSpacing: Longint;     { Line spacing depending on Rule         }
  578.     sStyle: Smallint;           { Style handle                             }
  579.     bLineSpacingRule: Byte;     { Rule for line spacing (see tom.doc)     }
  580.     bCRC: Byte;                 { Reserved for CRC for rapid searching     }
  581.     wShadingWeight: Word;       { Shading in hundredths of a per cent     }
  582.     wShadingStyle: Word;        { Nibble 0: style, 1: cfpat, 2: cbpat     }
  583.     wNumberingStart: Word;      { Starting value for numbering             }
  584.     wNumberingStyle: Word;      { Alignment, roman/arabic, (), ), ., etc. }
  585.     wNumberingTab: Word;        { Space bet 1st indent and 1st-line text }
  586.     wBorderSpace: Word;         { Space between border and text (twips) }
  587.     wBorderWidth: Word;         { Border pen width (twips)                 }
  588.     wBorders: Word;             { Byte 0: bits specify which borders     }
  589.                                 { Nibble 2: border style, 3: color index }
  590.   end;
  591.  
  592. { PARAFORMAT 2.0 masks and effects }
  593. const
  594.   PFM_SPACEBEFORE                     = $00000040; 
  595.   PFM_SPACEAFTER                      = $00000080; 
  596.   PFM_LINESPACING                     = $00000100; 
  597.   PFM_STYLE                           = $00000400; 
  598.   PFM_BORDER                          = $00000800;      { (*)     }
  599.   PFM_SHADING                         = $00001000;      { (*)     }
  600.   PFM_NUMBERINGSTYLE                  = $00002000;      { (*)     }
  601.   PFM_NUMBERINGTAB                    = $00004000;      { (*)     }
  602.   PFM_NUMBERINGSTART                  = $00008000;      { (*)     }
  603.  
  604.   PFM_RTLPARA                         = $00010000; 
  605.   PFM_KEEP                            = $00020000;      { (*)     }
  606.   PFM_KEEPNEXT                        = $00040000;      { (*)     }
  607.   PFM_PAGEBREAKBEFORE                 = $00080000;      { (*)     }
  608.   PFM_NOLINENUMBER                    = $00100000;      { (*)     }
  609.   PFM_NOWIDOWCONTROL                  = $00200000;      { (*)     }
  610.   PFM_DONOTHYPHEN                     = $00400000;      { (*)     }
  611.   PFM_SIDEBYSIDE                      = $00800000;      { (*)     }
  612.  
  613.   PFM_TABLE                           = $c0000000;      { (*)     }
  614.  
  615. { Note: PARAFORMAT has no effects }
  616.  
  617.   PFM_EFFECTS = PFM_RTLPARA or PFM_KEEP or PFM_KEEPNEXT or PFM_TABLE or 
  618.     PFM_PAGEBREAKBEFORE or PFM_NOLINENUMBER or 
  619.     PFM_NOWIDOWCONTROL or PFM_DONOTHYPHEN or PFM_SIDEBYSIDE or PFM_TABLE; 
  620.  
  621.   PFM_ALL2 = PFM_ALL or PFM_EFFECTS or PFM_SPACEBEFORE or PFM_SPACEAFTER or 
  622.     PFM_LINESPACING or PFM_STYLE or PFM_SHADING or PFM_BORDER or 
  623.     PFM_NUMBERINGTAB or PFM_NUMBERINGSTART or PFM_NUMBERINGSTYLE; 
  624.  
  625.   PFE_RTLPARA                         = PFM_RTLPARA         shr 16; 
  626.   PFE_KEEP                            = PFM_KEEP             shr 16;                     { (*)     }
  627.   PFE_KEEPNEXT                        = PFM_KEEPNEXT         shr 16;          { (*)     }
  628.   PFE_PAGEBREAKBEFORE                 = PFM_PAGEBREAKBEFORE shr 16;     { (*)     }
  629.   PFE_NOLINENUMBER                    = PFM_NOLINENUMBER     shr 16;       { (*)     }
  630.   PFE_NOWIDOWCONTROL                  = PFM_NOWIDOWCONTROL     shr 16;     { (*)     }
  631.   PFE_DONOTHYPHEN                     = PFM_DONOTHYPHEN      shr 16;       { (*)     }
  632.   PFE_SIDEBYSIDE                      = PFM_SIDEBYSIDE         shr 16;        { (*)     }
  633.  
  634.   PFE_TABLEROW                        = $c000;          { These 3 options are mutually     }
  635.   PFE_TABLECELLEND                    = $8000;          {  exclusive and each imply     }
  636.   PFE_TABLECELL                       = $4000;          {  that para is part of a table }
  637.  
  638.  *    PARAFORMAT numbering options (values for wNumbering):
  639.  *
  640.  *        Numbering Type        Value    Meaning
  641.  *        tomNoNumbering             0        Turn off paragraph numbering
  642.  *        tomNumberAsLCLetter      1        a, b, c, ...
  643.  *        tomNumberAsUCLetter      2        A, B, C, ...
  644.  *        tomNumberAsLCRoman      3        i, ii, iii, ...
  645.  *        tomNumberAsUCRoman      4        I, II, III, ...
  646.  *        tomNumberAsSymbols      5        default is bullet
  647.  *        tomNumberAsNumber         6        0, 1, 2, ...
  648.  *        tomNumberAsSequence      7        tomNumberingStart is first Unicode to use
  649.  *
  650.  *    Other valid Unicode chars are Unicodes for bullets.
  651. }
  652.  
  653.   PFA_JUSTIFY                         = 4;      { New paragraph-alignment option 2.0 (*) }
  654.  
  655. { notification structures }
  656. type
  657.   PMsgFilter = ^TMsgFilter;
  658.   TMsgFilter = record
  659.     nmhdr: TNMHdr;
  660.     msg: UINT;
  661.     wParam: WPARAM;
  662.     lParam: LPARAM;
  663.   end;
  664.  
  665.   PReqSize = ^TReqSize;
  666.   TReqSize = record
  667.     nmhdr: TNMHdr;
  668.     rc: TRect;
  669.   end;
  670.  
  671.   PSelChange = ^TSelChange;
  672.   TSelChange = record
  673.     nmhdr: TNMHdr;
  674.     chrg: TCharRange;
  675.     seltyp: Word;
  676.   end;
  677.  
  678. const
  679.   SEL_EMPTY           = $0000; 
  680.   SEL_TEXT            = $0001; 
  681.   SEL_OBJECT          = $0002; 
  682.   SEL_MULTICHAR       = $0004; 
  683.   SEL_MULTIOBJECT     = $0008; 
  684.  
  685. { used with IRichEditOleCallback::GetContextMenu, this flag will be
  686.    passed as a "selection type".  It indicates that a context menu for
  687.    a right-mouse drag drop should be generated.  The IOleObject parameter
  688.    will really be the IDataObject for the drop
  689. }
  690.   GCM_RIGHTMOUSEDROP      = $8000; 
  691.  
  692. type
  693.   TEndDropFiles = record
  694.     nmhdr: TNMHdr;
  695.     hDrop: THandle;
  696.     cp: Longint;
  697.     fProtected: Bool;
  698.   end;
  699.  
  700.   PENProtected = ^TENProtected;
  701.   TENProtected = record
  702.     nmhdr: TNMHdr;
  703.     msg: UINT;
  704.     wParam: WPARAM;
  705.     lParam: LPARAM;
  706.     chrg: TCharRange;
  707.   end;
  708.  
  709.   PENSaveClipboard = ^TENSaveClipboard;
  710.   TENSaveClipboard = record
  711.     nmhdr: TNMHdr;
  712.     cObjectCount: Longint;
  713.     cch: Longint;
  714.   end;
  715.  
  716.   TENOleOpFailed = packed record 
  717.     nmhdr: TNMHdr;
  718.     iob: Longint;
  719.     lOper: Longint;
  720.     hr: HRESULT;
  721.   end;
  722.  
  723. const
  724.   OLEOP_DOVERB        = 1; 
  725.  
  726. type
  727.   TObjectPositions = packed record 
  728.     nmhdr: TNMHdr;
  729.     cObjectCount: Longint;
  730.     pcpPositions: PLongint;
  731.   end;
  732.  
  733.   TENLink = record 
  734.     nmhdr: TNMHdr;
  735.     msg: UINT;
  736.     wParam: WPARAM;
  737.     lParam: LPARAM;
  738.     chrg: TCharRange;
  739.   end;
  740.  
  741. { PenWin specific }
  742.   TENCorrectText = record
  743.     nmhdr: TNMHdr;
  744.     chrg: TCharRange;
  745.     seltyp: Word;
  746.   end;
  747.  
  748. { Far East specific }
  749.   TPunctuation = record
  750.     iSize: UINT;
  751.     szPunctuation: PChar;
  752.   end;
  753.  
  754. { Far East specific }
  755.   TCompColor = record
  756.     crText: TColorRef;
  757.     crBackground: TColorRef;
  758.     dwEffects: Longint;
  759.   end;
  760.  
  761. { clipboard formats - use as parameter to RegisterClipboardFormat }
  762.  
  763. const
  764.   CF_RTF                 = 'Rich Text Format';
  765.   CF_RTFNOOBJS           = 'Rich Text Format Without Objects'; 
  766.   CF_RETEXTOBJ           = 'RichEdit Text and Objects';
  767.  
  768. type
  769.   TRepasteSpecial = record
  770.     dwAspect: DWORD;
  771.     dwParam: DWORD;
  772.   end;
  773.  
  774. {     UndoName info }
  775.  
  776.   UNDONAMEID = (UID_UNKNOWN, UID_TYPING, UID_DELETE, UID_DRAGDROP, UID_CUT,
  777.     UID_PASTE);
  778.  
  779. { flags for the GETEXTEX data structure }
  780.  
  781. const
  782.   GT_DEFAULT                  = 0; 
  783.   GT_USECRLF                  = 1; 
  784.  
  785. { EM_GETTEXTEX info; this struct is passed in the wparam of the message }
  786.  
  787. type
  788.   TGetTextEx = record 
  789.     cb: DWORD;                 { count of bytes in the string  }
  790.     flags: DWORD;              { flags (see the GT_XXX defines }
  791.     codepage: UINT;            { code page for translation (CP_ACP for default,
  792.                                  1200 for Unicode                      }
  793.     lpDefaultChar: LPCSTR;     { replacement for unmappable chars             }
  794.     lpUsedDefChar: PBOOL;      { pointer to flag set when def char used     }
  795.   end;
  796.  
  797. { flags for the GETTEXTLENGTHEX data structure }
  798.  
  799. const
  800.   GTL_DEFAULT         = 0;      { do the default (return # of chars)         }
  801.   GTL_USECRLF         = 1;      { compute answer using CRLFs for paragraphs }
  802.   GTL_PRECISE         = 2;      { compute a precise answer                     }
  803.   GTL_CLOSE           = 4;      { fast computation of a "close" answer         }
  804.   GTL_NUMCHARS        = 8;      { return the number of characters             }
  805.   GTL_NUMBYTES        = 16;     { return the number of _bytes_                 }
  806.  
  807. { EM_GETTEXTLENGTHEX info; this struct is passed in the wparam of the msg }
  808.  
  809. type
  810.   TGetTextLengthEx = record 
  811.     flags: DWORD;              { flags (see GTL_XXX defines)                 }
  812.     codepage: UINT;            { code page for translation (CP_ACP for default,
  813.                                  1200 for Unicode                      }
  814.   end;
  815.  
  816. { UNICODE embedding character }
  817. const
  818.   WCH_EMBEDDING     = $FFFC; 
  819.  
  820. implementation
  821.  
  822. end.
  823.